package views
{
	import inerface.IMapContainerPanel;
	
	import main.ViewSubBase;
	
	import panel.mapPanel.MapContainerPanel;
	
	public class MapCotainerView extends ViewSubBase
	{
		private var _panel:IMapContainerPanel;
		private var infoList:Array;
		
		public function MapCotainerView()
		{
			infoList = [];
		}
		
		public function set info(list:Array):void
		{
			infoList = list;
		}
		
		public override function show():void
		{
			render();
		}
		
		protected override function render():void
		{
			if(!_panel){
				_panel = new MapContainerPanel;
				_panel.init(view.layout.stage,view.resourceLoader,view.lang,view.uri);
				
				_panel.onShowPath = swapToPath;
			}
			_panel.changeData(infoList);
			
			this.addView(_panel);
		}
		
		public override function clear():void
		{
			if(_panel){
				_panel.clear();
				_panel = null;
			}
		}
		
		public override function close():void
		{
			closeView(this);
		}
		
		private function swapToPath(list:Array):void
		{
			view.selectPath.pathList = list;
			view.selectPath.show();
		}
	}
}